unit FechamentoCaixa;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FMTBcd, DB, SqlExpr, ExtCtrls, StdCtrls;

type
    TChars = set of Char;
  TFrmFechamentoCaixa = class(TForm)
    Shape1: TShape;
    Bevel2: TBevel;
    Bevel1: TBevel;
    Shape2: TShape;
    Label3: TLabel;
    Label4: TLabel;
    Label7: TLabel;
    Label2: TLabel;
    Label5: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label1: TLabel;
    Shape3: TShape;
    Label6: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Bevel3: TBevel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Button1: TButton;
    Button2: TButton;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Edcodigo: TEdit;
    Timer1: TTimer;
    SQLStoredProc1: TSQLStoredProc;
    procedure Edit5Exit(Sender: TObject);
    procedure Edit4Exit(Sender: TObject);
    procedure Edit6Exit(Sender: TObject);
    procedure Edit7Exit(Sender: TObject);
    procedure Edit8Exit(Sender: TObject);
    procedure Edit11Exit(Sender: TObject);
    procedure Edit14Exit(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmFechamentoCaixa: TFrmFechamentoCaixa;

implementation

{$R *.dfm}

function FilterChars(const S: string; const ValidChars: TChars): string;
var
  I: integer;
begin
  Result := '';
  for I := 1 to Length(S) do
  if S[I] in ValidChars then
  Result := Result + S[I];
end;



procedure TFrmFechamentoCaixa.Edit5Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

procedure TFrmFechamentoCaixa.Edit4Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

procedure TFrmFechamentoCaixa.Edit6Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

procedure TFrmFechamentoCaixa.Edit7Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

procedure TFrmFechamentoCaixa.Edit8Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

procedure TFrmFechamentoCaixa.Edit11Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

procedure TFrmFechamentoCaixa.Edit14Exit(Sender: TObject);
begin
 if TEdit(Sender).Text <> '' Then
  TEdit(Sender).Text := FormatFloat('#,##0.00',StrToFloat(FilterChars(TEdit(Sender).Text,['0'..'9',','])))
 Else
  TEdit(Sender).Text := '0,00';

end;

end.
